package java_thinking.unit_9._9_9;

/**
 * @Description :
 * @author: cww
 * @DateTime: 2019/3/7 9:08
 */
interface BasicService {
    void method1();
    void method2();
}

class ServiceDetail implements BasicService {

    @Override
    public void method1() {
        System.out.println("ServiceDetail.method1()");
    }

    @Override
    public void method2() {
        System.out.println("ServiceDetail.method2()");
    }
}

interface ServiceFactory1 {
    BasicService getBasicService();
}

class ServiceDetailFactory implements ServiceFactory1{
    @Override
    public BasicService getBasicService(){
        return new ServiceDetail();
    }
}

class TestFactory{
    public static void serviceConsumer1(ServiceFactory1 factory1){
        BasicService s = factory1.getBasicService();
        s.method1();
        s.method2();
    }

    public static void main(String[] args) {
        serviceConsumer1(new ServiceDetailFactory());
    }
}